t=int(input())
def solve():
n=int(input())
lst=list(map(int,input().split()))
x=sum(lst)
count_0=0
count_1=0
for i in range(n):
if lst[i]==0:
count_0+=1
if lst[i]==1:
count_1+=1
print(pow(2,count_0)*count_1)
while t:
solve()
t-=1
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define loop(i,a,n) for(int i = a; i <= n; i++)
#define loopr(i,n,a) for(int i = n; i >= a; i--)
#define foor(i,n) for(int i = 0; i < n; i++)
#define fore(el,v) for(auto& el:v)
#define cin(v) for(auto& el:v) cin>>el;
#define cout(v) for(auto el:v) cout<<el<<" "; cout<<'\n';
#define undirected(m) for(int iii=0;iii<m;iii++){int aaa,bbb;cin >> aaa >> bbb;adj[aaa].push_back(bbb);adj[bbb].push_back(aaa);}
#define directed(m) for(int iii=0;iii<m;iii++){int aaa,bbb;cin >> aaa >> bbb;adj[aaa].push_back(bbb);}
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Ones(n) __builtin_popcount(n)
#define Onesll(n) __builtin_popcountll(n)
#define PI acos(-1)
#define sin(a) sin((a)*PI/180)
#define cos(a) cos((a)*PI/180)
#define tan(a) tan((a)*PI/180)
#define fast ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define endl '\n'
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pi = pair<int,int>;
using pll = pair<ll,ll>;
using tiii = tuple<int,int,int>;
using tlll = tuple<ll,ll,ll>;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vpi = vector<pair<int,int>>;
using vvi = vector<vector<int>>;
using mii = map<int,int>;
const int MOD = 1e9+7;
const int OO = 2e9;
const int N = 1e6+5, M = 1e3+5, LG = 20;
ll powmod(ll x, ll y)
{
x %= MOD;
ll ans = 1;
while(y)
{
if(y & 1) ans = ans * x % MOD;
x = x * x % MOD;
y >>= 1;
}
return ans;
}
ll fact[N], modInv[N];
void preprocess(){
fact[0] = 1;
loop(i,1,N-1){
fact[i] = (fact[i-1] * i)%MOD;
}
modInv[N-1] = powmod(fact[N-1], MOD-2);
loopr(i,N-2,0){
modInv[i] = (modInv[i+1] * (i+1)) %MOD;
}
}
ll nCr(int n,int r) {
if (r > n)
return 0;
// return ( n! / ((n-r)! * r!) ) % mod
return (((fact[n] * modInv[n - r]) % MOD) * modInv[r]) % MOD;
}
ll add(ll a, ll b) {
a += b;
if (a >= MOD) a -= MOD;
return a;
}
ll sub(ll a, ll b) {
a -= b;
if (a < 0) a += MOD;
return a;
}
ll mul(ll a, ll b) {
return a * b % MOD;
}
ll inv(ll a) {
return powmod(a, MOD - 2);
}
ll fastpow(ll b, ll p) {
if (!p) return 1;
ll ret = fastpow(b, p >> 1);
ret *= ret;
if (p & 1)
ret *= b;
return ret;
}
void TC()
{
int n;
cin >> n;
ll x,l=0,o=0;
foor(i,n){
cin >> x;
if(x==0) o++;
else if(x==1) l++;
}
cout << fastpow(2,o) * l;
}
int32_t main()
{
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin); freopen("output.out", "w", stdout);
#endif
fast
int t = 1;
cin >> t;
// preprocess();
while (t--)
{
TC();
cout << '\n';
}
return 0;
}
1641A - Great Sequence | 1537A - Arithmetic Array |
1370A - Maximum GCD | 149A - Business trip |
34A - Reconnaissance 2 | 59A - Word |
462B - Appleman and Card Game | 1560C - Infinity Table |
1605C - Dominant Character | 1399A - Remove Smallest |
208A - Dubstep | 1581A - CQXYM Count Permutations |
337A - Puzzles | 495A - Digital Counter |
796A - Buying A House | 67A - Partial Teacher |
116A - Tram | 1472B - Fair Division |
1281C - Cut and Paste | 141A - Amusing Joke |
112A - Petya and Strings | 677A - Vanya and Fence |
1621A - Stable Arrangement of Rooks | 472A - Design Tutorial Learn from Math |
1368A - C+= | 450A - Jzzhu and Children |
546A - Soldier and Bananas | 32B - Borze |
1651B - Prove Him Wrong | 381A - Sereja and Dima |